<?php
//简单管理页面范例，在你的管理页面引用coresection/checkA.php就OK，当然，不要忘了添加注销登录的链接
include_once '../coresection/checkA.php';
?>

<?
include_once("../../config_controller.php");
$host = $_SERVER['HTTP_HOST']; //取得进入所输入的域名
$theme_folder = host_theme($host);

include_once '../../front/'.$theme_folder.'/connection.php';include_once '../coresection/check_session.php';;
?>

<?php include_once("function.php"); ?>
<?php include "../../front/".$theme_folder."/config.php"; ?>

<?php
if(!isset($_SESSION)){
session_start();
}



$nid = $_REQUEST['nid'];

$result = array('error' => 0, 'message' => '', 'content' => '');

if(!$nid){
		
	$result['error'] = 1;
	$result['message'] = '数据有误，请刷新再操作';

	die(json_encode($result));
	exit;	
}


//公用模式
global $table_Prefix;
	
	if($nid > 0){
		
		$product_attr_info = select_one_line_all_items($table_Prefix . "product_attr", " nid = '".$nid."'  ");
		
		$sql = " DELETE   FROM ".$table_Prefix."product_attr where nid = $nid ";
		
		$res =  mysql_query($sql);
		
		if($res){
			unlink(ROOT_PATH_."/uploadfiles/".$theme_folder."/".$product_attr_info['img_url']);
			$result['error'] = 0;
			$result['message'] = '删除成功';
			die(json_encode($result));
			exit;	
		}
		else{
			$result['error'] = 1;
			$result['message'] = '删除失败';
			die(json_encode($result));
			exit;	
		}
	}
	else{
			$result['error'] = 1;
			$result['message'] = '参数有误';
			die(json_encode($result));
			exit;	
		}
	

?>